package Test;

import java.util.ArrayList;
import org.junit.Test;
import DBLayer.DBPerson;
import ModelLayer.Person;

public class TestDBPerson
{
	DBPerson dbp = new DBPerson();
	ArrayList<Person> plist = dbp.getAllPersons(false);

	@Test
	public void testGetAllPersons() {
	    System.out.println("\nPerson size : " + plist.size() + "\n");
	}

	@Test
	public void testSearchPersonPhoneNr() {
		String phone = "98211347";
		int index = 1;
		boolean found = false;
		while(!found && index <= plist.size())
		{
			Person p = dbp.searchPersonPhoneNr(phone, false);
			System.out.println("PersonID    : " + p.getPersonID());
			System.out.println("FirstName   : " + p.getfName());
			System.out.println("LastName    : " + p.getlName());
			System.out.println("Address     : " + p.getAddress());
			System.out.println("PostalCode  : " + p.getPostalCode());
			System.out.println("City        : " + p.getCity());
			System.out.println("PhoneNr     : " + p.getPhoneNr());
			System.out.println("MobileNr    : " + p.getMobileNr());
			System.out.println("Email       : " + p.getEmail());
			System.out.println("---------------------------------");
			if(p.getPhoneNr().equals(phone))
            {
                found = true;
            }
            index++;
        }
        if(found == true)
        {
            return;
        }
        else
        {
            return;
		}
	}
/*
	@Test
	public void testSearchPersonMobileNr() {
		fail("Not yet implemented");
	}

	@Test
	public void testInsertPerson() {
		fail("Not yet implemented");
	}

	@Test
	public void testUpdatePerson() {
		fail("Not yet implemented");
	}

	@Test
	public void testDelete() {
		fail("Not yet implemented");
	}

	@Test
	public void testGetAllPersons() {
		fail("Not yet implemented");
	}
*/
}
